<?php


namespace App\Job;


use Predis\Client;

abstract class Jobs
{
    public $queue = 'default';

    public $payload;

    public $reserved = false;


    public function delete()
    {

    }

    abstract public function getRawBody();

    public function payload()
    {
        return json_decode($this->getRawBody(), true);
    }

    public function attempts()
    {
        return $this->payload()['attempts'] ?? 0;
    }

    /**
     * @return mixed
     */
    public function getReservedJob()
    {
        return $this->reserved;
    }

    abstract public function handle();
}